﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DBUtilitySqlsever;
namespace STOPPLANService
{
   public class STOPPLANMes
    {
       /// <summary>
       /// 查询mes数据信息
       /// </summary>
       /// <returns></returns>
       public DataTable SelectMesSTOPPLAN_View()
        {
            DataTable dt = new DataTable();
            string sql = "select * from STOPPLAN_View where PLANSTIM>(select datetime from datebt)";
            try
            {
                dt = DbHelperSQL.QueryTable(sql.ToString());

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return dt;
        }
       /// <summary>
       /// 查询没有同步的信息
       /// </summary>
       /// <returns></returns>
       public DataTable SelectMesSTOPPLAN_Del()
       {
           DataTable dt = new DataTable();
           string sql = "select * from Deletetab";
           try
           {
               dt = DbHelperSQL.QueryTable(sql.ToString());

           }
           catch (Exception ex)
           {
               throw ex;
           }
           return dt;
       }
       /// <summary>
       /// 删除
       /// </summary>
       /// <returns></returns>
       public int delDeletetab(string num)
       {
           int flag = 0;
           string sql = "delete from  Deletetab where Nonum=" + num + "";
           flag = DbHelperSQL.ExecuteSql(sql.ToString());
           return flag;
       }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public int updateMes()
        {

            int flag = 0;
            string data = DateTime.Now.ToString("yyyyMMddhhmm");
            string sql = "update datebt set datetime='" + data + "'";
            flag = DbHelperSQL.ExecuteSql(sql.ToString());
            return flag;
        }
    }
}
